//
/**
 * Filename: fig10-19_signal_intr.c
 * Author:   csbonkers
 * Contact:  forever65535@qq.com
 * Date:     2021/6/19
 * Description:
 *    用sigaction实现signal（不自动重启中断的系统调用）
 */

#include "apue.h"


static void sig_alrm(int signo){
  // nothing to do
}
int main(int argc, char *argv[]) {

  c_signal_intr(SIGALRM, sig_alrm);
  alarm(5);
  char buf[MAXLINE];
  int rn;
  if((rn = read(STDIN_FILENO,buf,MAXLINE))< 0){
    perror("read error");
    return 0;
  }
  write(STDOUT_FILENO, buf, rn);
  return 0;
}